<template>
  <div class="research-direction">
    <div class="page-header">
      <div class="header-content">
        <h1 class="page-title">研究方向</h1>
        <div class="title-underline"></div>
        <p class="page-subtitle">Research Directions</p>
      </div>
    </div>

    <!-- 为每个内容块添加fade-in-section类和ref标识 -->
    <div class="content-wrapper fade-in-section" ref="section1">
      <!-- 左侧文字卡片1 -->
      <div class="text-card">
        <div class="card-header">
          <h2>图像/视频处理与计算机视觉</h2>
        </div>
        <div class="card-body">
          <p>
            深耕视觉基础模型，探索目标检测与跟踪中的关键问题，专注于基于深度学习的视觉信息理解，系统研究包括目标检测、目标跟踪及复杂场景下的多目标跨镜跟踪。检测类算法（RV-YOLO）可用于多种不同场景下不同目标的检测和识别，算法输出目标物体或行为的位置坐标框、类别以及置信度值。针对检测需求，研发了各类不同应用场景下的目标检测算法架构。
          </p>
        </div>
      </div>

      <!-- 右侧轮播图1 -->
      <div class="carousel-container">
        <el-carousel height="400px" indicator-position="outside">
          <el-carousel-item v-for="(item, index) in carouselItems1" :key="index">
            <div class="carousel-item">
              <img :src="item.image" :alt="item.title" />
            </div>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>

    <div class="content-wrapper fade-in-section" ref="section2">
      <!-- 左侧文字卡片2 -->
      <div class="text-card">
        <div class="card-header">
          <h2>多模态大模型与深度学习</h2>
        </div>
        <div class="card-body">
          <p>
            探索视觉-语言大模型的前沿算法，研究图像、视频、文本等多模态信息的深度融合与理解，赋予机器更强的环境感知与认知能力。
          </p>
        </div>
      </div>
      <!-- 右侧图片2 -->
      <div class="image-container">
        <img :src="carouselItems2[0].image" alt="多模态大模型" class="single-image" />
      </div>
    </div>

    <div class="content-wrapper fade-in-section" ref="section3">
      <!-- 左侧文字卡片3 -->
      <div class="text-card">
        <div class="card-header">
          <h2>边缘计算与分布式计算</h2>
        </div>
        <div class="card-body">
          <p>
            针对安防场景的实时性要求，研究轻量化模型设计与边缘端高效部署技术，推动AI算力下沉，实现前端智能与快速响应。该平台将流媒体接入、视频资源解码、算法推理和数据管理等功能模块进行灵活解耦，支持资源的动态调度与弹性伸缩，平台可以根据实际视频流和算法任务的数量，精确分配计算资源，实现对多路视频流、多种算法的高并发实时分析，彻底避免了传统方案的资源闲置与能源浪费，将硬件利用率最大化。
          </p>
        </div>
      </div>
      <!-- 右侧图片3 -->
      <div class="image-container">
        <img :src="carouselItems3[0].image" alt="多模态大模型" class="single-image" />
      </div>
    </div>

    <div class="content-wrapper fade-in-section" ref="section4">
      <!-- 左侧文字卡片4 -->
      <div class="text-card">
        <div class="card-header">
          <h2>行为识别与视频理解分析</h2>
        </div>
        <div class="card-body">
          <p>
            基于视频数据，研发复杂场景下的异常行为识别、人群流量分析及特定事件检测算法，为决策提供精准的数据支持。针对多种场景下单人或多人行为的分析与识别，研发实时行为检测算法RTVN（Real-Time
            Violence
            Network）。算法可检出何时何位置出现了目标行为，并输出目标行为的类别。智能安防领域：打架行为、手扶屏蔽门、跌倒等异常动作。
          </p>
        </div>
      </div>
      <!-- 右侧轮播图4 -->
      <div class="carousel-container">
        <el-carousel height="400px" indicator-position="outside">
          <el-carousel-item v-for="(item, index) in carouselItems4" :key="index">
            <div class="carousel-item">
              <img :src="item.image" :alt="item.title" />
            </div>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>

    <div class="content-wrapper fade-in-section" ref="section5">
      <!-- 左侧文字卡片5 -->
      <div class="text-card">
        <div class="card-header">
          <h2>大数据智能处理与分析</h2>
        </div>
        <div class="card-body">
          <p>
            致力于构建支撑智能安防的大数据平台，研究高并发数据处理、动态特征提取与模式发现技术，为全景感知与行为分析模型提供可靠的数据基石和洞察力。
          </p>
        </div>
      </div>
      <!-- 右侧轮播图5 -->
      <div class="carousel-container">
        <el-carousel height="400px" indicator-position="outside">
          <el-carousel-item v-for="(item, index) in carouselItems5" :key="index">
            <div class="carousel-item">
              <img :src="item.image" :alt="item.title" />
            </div>
          </el-carousel-item>
        </el-carousel>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'ResearchDirection',
  data() {
    return {
      carouselItems1: [
        {
          image: require('@/assets/img/vision1.png'),
          // routepath: '/researchDirection/bigModel'
        },
        {
          image: require('@/assets/img/vision2.png'),
          // routepath: '/researchDirection/actionRecognition'
        },
        {
          image: require('@/assets/img/vision3.png'),
          // routepath: '/researchDirection/edgeComputer'
        },
        {
          image: require('@/assets/img/vision4.png'),
          // routepath: '/researchDirection/intelligentAgent'
        }
      ],
      carouselItems2: [
        {
          image: require('@/assets/img/deepstudy.png'),
          // routepath: '/researchDirection/bigModel'
        },
      ],
      carouselItems3: [
        {
          image: require('@/assets/img/edgecomputer.png'),
          // routepath: '/researchDirection/edgeComputer'
        },
      ],
      carouselItems4: [
        {
          image: require('@/assets/img/analyse1.png'),
          // routepath: '/researchDirection/actionRecognition'
        },
        {
          image: require('@/assets/img/analyse2.png'),
          // routepath: '/researchDirection/abnormalBehaviorRecognition'
        },
      ],
      carouselItems5: [
        {
          image: require('@/assets/img/bigdata1.png'),
          // routepath: '/researchDirection/abnormalBehaviorRecognition'
        },
        {
          image: require('@/assets/img/bigdata2.jpeg'),
          // routepath: '/researchDirection/abnormalBehaviorRecognition'
        },
        {
          image: require('@/assets/img/bigdata3.jpeg'),
          // routepath: '/researchDirection/abnormalBehaviorRecognition'
        },
      ],
    }
  },
  mounted() {
    // 监听滚动事件
    window.addEventListener('scroll', this.handleScroll)
    // 初始化检查元素是否在视口中
    this.checkFadeElements()
  },
  beforeDestroy() {
    // 移除滚动事件监听
    window.removeEventListener('scroll', this.handleScroll)
  },
  methods: {
    handleScroll() {
      this.checkFadeElements()
    },
    checkFadeElements() {
      // 检查所有需要渐入的元素
      const sections = [
        this.$refs.section1,
        this.$refs.section2,
        this.$refs.section3,
        this.$refs.section4,
        this.$refs.section5
      ]

      sections.forEach(section => {
        if (section) {
          const rect = section.getBoundingClientRect()
          // 当元素进入视口时添加显示类
          if (rect.top < window.innerHeight * 0.85) {
            section.classList.add('visible')
          }
        }
      })
    }
  }
}
</script>

<style scoped>
.research-direction {
  padding: 20px;
}

.page-header {
  color: white;
  padding: 0;
  margin-bottom: 20px;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  text-align: center;
}

.page-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 10px;
  margin-top: 10px;
  color: #6a11cb;
}

.title-underline {
  width: 80px;
  height: 4px;
  background: linear-gradient(90deg, #00c9ff, #92fe9d);
  margin: 0 auto 20px;
  border-radius: 2px;
}

.page-subtitle {
  font-size: 1.1rem;
  opacity: 0.9;
  max-width: 800px;
  margin: 0 auto;
  color: #6a11cb;
}

.content-wrapper {
  display: flex;
  gap: 30px;
  margin: 0 auto;
  max-width: 1200px;
  margin-bottom: 60px; /* 增加底部间距，让滚动效果更明显 */
}

.text-card {
  flex: 1;
  min-width: 300px;
}

.card-header {
  background: #f8f9fa;
  padding: 20px;
  border-radius: 8px 8px 0 0;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  margin: 0;
  color: #333;
  font-size: 1.5rem;
}

.card-body {
  background: white;
  padding: 20px;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 6px 16px rgba(148, 3, 232, 0.193);
  height: 310px;
}

.card-body p {
  color: #666;
  line-height: 1.8;
  margin: 0 0 15px;
  font-size: 1.1rem;
}

.carousel-container {
  flex: 2;
  min-width: 400px;
  margin-left: 20px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(193, 132, 227, 0.363);
}

.carousel-item {
  position: relative;
  width: 100%;
  height: 100%;
}

.carousel-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.carousel-text {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.6);
  color: white;
  padding: 0px;
  text-align: center;
}

.carousel-text h2 {
  margin: 0 0 10px 0;
  font-size: 24px;
}

/* 自定义轮播指示器样式 */
::v-deep .el-carousel__indicator--horizontal {
  padding: 10px 0;
}

::v-deep .el-carousel__button {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin: 0 5px;
  background-color: rgba(86, 6, 161, 0.733);
}

::v-deep .el-carousel__arrow {
  width: 50px;
  height: 50px;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  border: 1px solid black;
  opacity: 0.8;
  transition: all 0.3s ease;
  font-size: 24px;
  color: black;
  display: flex;
  align-items: center;
  justify-content: center;
}

::v-deep .el-carousel__arrow:hover {
  background-color: #6c2bd9;
  color: white;
  border-color: #6c2bd9;
}

.image-container {
  flex: 2;
  min-width: 700px;
  margin-left: 20px;
  border: 1px solid #e6e6e6;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(193, 132, 227, 0.363);
  display: flex;
  justify-content: center;
  align-items: center;
}

.single-image {
  height: 425px;
  width: 700px;
  object-fit: contain;
  border-radius: 8px;
}

/* 滚动渐入效果样式 */
.fade-in-section {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.8s ease-out, transform 0.8s ease-out;
}

.fade-in-section.visible {
  opacity: 1;
  transform: translateY(0);
}
</style>